package org.fund.framework.service;

import org.fund.base_service.domain.SysUser;
import org.fund.base_service.service.ISysUserService;
import org.fund.common.core.model.RegisterBody;
import org.fund.common.util.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author Moro
 * @Date 2022/3/13 0:05
 * @title SysRegisterService
 */
@Service
public class SysRegisterService {
    @Autowired
    private ISysUserService sysUserService;
    public void register(RegisterBody registerBody){
        SysUser user = new SysUser();
        BeanUtils.copyProperties(registerBody, user);
        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
        sysUserService.insertUser(user);
    }
}
